<?php if($opc=="new"){ ?>
<form class="well form-horizontal span8" action="<?php echo base_url() . "admin.php/matinicial/procesar" ?>" method="post">
<?php }else{ ?>
<form class="well form-horizontal span8" action="<?php echo base_url() . "admin.php/matinicial/procesarm" ?>" method="post">
    
<?php } ?>     
    <legend>CREAR MATRICULAS PRIMER CICLO</legend>

    <div class="control-group">
        <label class="control-label" for="select01">PERIODO ACTUAL</label>
        <div class="controls ">
            <select name="ide_lec" class="span3">
                <?php
                foreach ($periodos as $i => $per) {
                    echo ("<option value='" . $per["ide_lec"] . "'>");
                    echo ($per["descripcion_lec"] . "</option>");
                }
                ?>
            </select>

        </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="select03">CARRERAS</label>
        <div class="controls ">
            <select name="ide_car" class="span3" autofocus
                    ONCHANGE="javascript:enviar(this.options[this.selectedIndex].value, '<?php echo (base_url()) . "admin.php/matinicial/crear" ?>');">
                        <?php
                        if ($ide_car == -1)
                            echo ("<option value='-1' selected>Seleccionar Carrera</option>");
                        foreach ($carrera as $i => $car) {
                            echo ("<option value='" . $car["ide_car"] . "'");
                            echo (($ide_car == $car["ide_car"] ? " selected" : "") . ">");
                            echo ($car["nombre_car"] . "</option>");
                        }
                        ?>
            </select>

        </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="select03">Lista de Pensums</label>
        <div class="controls ">
            <select id="select02" name="ide_pen" class="span3"
                    ONCHANGE="javascript:enviar1('<?php echo (base_url()) . "admin.php/matinicial/crear" ?>',
                                    '<?php echo $ide_car ?>', this.options[this.selectedIndex].value);">

                <?php
                if ($ide_pen == -1)
                    echo ("<option value='-1' selected>Seleccionar Pensum</option>");

                foreach ($pensum as $i => $pen) {

                    echo ("<option value='" . $pen["ide_pen"] . "'");
                    echo (($ide_pen == $pen["ide_pen"] ? " selected" : "") . ">");
                    echo ($pen["descripcion_pen"] . "-" . $pen["estado_pen"] . "</option>");
                }
                ?>

            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="select04">Lista de Ciclos</label>
        <div class="controls ">
            <select id="codigo_cic"  name="codigo_cic" class="span3"
                    ONCHANGE="javascript:enviar2('<?php echo (base_url()) . "admin.php/matinicial/crear" ?>',
                                    '<?php echo $ide_car ?>', '<?php echo $ide_pen ?>', this.options[this.selectedIndex].value);">
                        <?php
                        if ($codigo_cic == -1)
                            echo ("<option value='-1' selected>Seleccionar Ciclo</option>");
                        foreach ($ciclo as $i => $cic) {
                            echo ("<option value='" . $cic["ide_cic"] . "'");
                            echo (($codigo_cic == $cic["ide_cic"] ? " selected" : "") . ">");
                            echo ($cic["codigo_cic"] . "-" . $cic["nombre_cic"] . "</option>");
                        }
                        ?>

            </select>
        </div>
    </div>

    <div class="control-group">
        <label class="control-label" for="select02">JORNADA DE TRABAJO</label>
        <div class="controls ">
            <select name="seccion" class="span3"
                    ONCHANGE="javascript:enviar3('<?php echo (base_url()) . "admin.php/matinicial/crear" ?>',
                                    '<?php echo $ide_car ?>', '<?php echo $ide_pen ?>', '<?php echo $codigo_cic ?>',
                                    this.options[this.selectedIndex].value);">
                        <?php
                        if ($seccion == -1)
                            echo ("<option value='-1' selected>Seleccionar Seccion</option>");
                        ?>  
                <option value="1"  <?php echo (($seccion == 1 ? " selected" : " ")); ?>>DIURNO </option>
                <option value="2"  <?php echo (($seccion == 2 ? " selected" : " ")); ?>> NOCTURNO</option>
                <option value="3" <?php echo (($seccion == 3 ? " selected" : " ")); ?>>FINES DE SEMANA</option>

            </select>


        </div>
    </div>

    <table border="0">
        <thead>
            <tr>
                <th></th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
                    <div class="control-group">
                        <label class="control-label" for="select03">PARALELO</label>
                        <div class="controls ">
                            <select name="paralelo" class="span1"
                                    ONCHANGE="javascript:enviar4('<?php echo (base_url()) . "admin.php/matinicial/crear" ?>',
                                                    '<?php echo $ide_car ?>', '<?php echo $ide_pen ?>', '<?php echo $codigo_cic ?>',
                                                    '<?php echo $seccion ?>', this.options[this.selectedIndex].value);">
                                        <?php
                                        if ($paralelo == -1)
                                            echo ("<option value='-1' selected>Seleccionar</option>");
                                        ?>  
                                <option value="A"  <?php echo (($paralelo == 'A' ? " selected" : " ")); ?>>A</option>
                                <option value="B"  <?php echo (($paralelo == 'B' ? " selected" : " ")); ?>>B</option>
                                <option value="C" <?php echo (($paralelo == 'C' ? " selected" : " ")); ?>>C</option>

                            </select>


                        </div>
                    </div>  
                </td>
                <td>
                    <div class="control-group">
                        <label class="control-label" for="select04">ESTUDIANTES</label>
                        <div class="controls ">
                            <select name="cod_est" class="span3">
                                <?php
                                foreach ($estudiantes as $l => $est) {
                                    echo ("<option value='" . $est["persona_ide_pers"] . "'>");
                                    echo ($est["apellido_pers"] . " " . $est["nombre_pers"] . "</option>");
                                }
                                ?>
                            </select>


                        </div>
                    </div> 
                </td>
                <td>
                    <div class="control-group">

                        <a href="<?php echo base_url() . "admin.php/estudiante/crear" ?>">
                            <span class="label label-info">CREAR</span></a>


                    </div>
                </td>                        
            </tr>
        </tbody>
    </table>





    <div class="controls">

        <button type="submit" class="btn"  <?php echo (($paralelo == -1 || $seccion == -1) ? "disabled " : " "); ?>>Iniciar Proceso</button>
        <input type="hidden" name='cambio' <?php echo " value='" . $cambio . "'"; ?>>
        
        <a href="<?php echo base_url() . "admin.php/matinicial/inicio" ?>">
            <img src="<?php echo base_url(); ?>commons/images/boton_volver.gif"></a>
    </div>



</form>




